var SearchForm = function () {
  var template = /* html */ `
    <div class="search-form">
    <sys-common-search :request-url="requestUrl" :request-data="requestData" :search="search"
      :search-field="searchField" label-width="auto" input-width="180px">
      <template slot="append">
        <el-form-item label="供方编号">
          <el-input v-model="search.providerNo" style="width:180px" placeholder="请输入供方编号"></el-input>
        </el-form-item>
        <el-form-item label="状态" v-if="!isCustomer">
          <el-select clearable v-model="search.status" style="width:180px">
            <el-option label="使用" :value="1"></el-option>
            <el-option label="禁用" :value="0"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="默认仓库">
          <el-select v-model="search.defaultWarehouse" style="width:180px">
            <el-option label="原材料仓" value="原材料仓"></el-option>
            <el-option label="辅料仓" value="辅料仓"></el-option>
          </el-select>
        </el-form-item>
      </template>
    </sys-common-search>
    </div>
  `;

  return {
    props: {
      search: {
        type: Object,
        required: true
      },
      type: {
        type: String,
        default: 'spot'
      },
      isCustomer: {
        type: Boolean,
        default: false
      }
    },

    data: function () {
      var isCustomer = this.isCustomer;
      var url = '';
      var searchField = [];
      if (isCustomer) {
        searchField = ['materialName', 'model', 'color', 'colorDescription', 'materialDept'];
        url = 'thirdPartyView/getMaterialSelectData';
      } else {
        searchField = ['materialName', 'model', 'color', 'colorDescription', 'providerName', 'materialDept'];
        url = 'materialSelectFilter/getMaterialSelectData';
      }
      return {
        requestUrl: url,
        searchField: searchField,
        requestData: {
          type: 4,
          isSpot: this.type === 'spot' ? 1 : 0
        }
      };
    },

    components: {
      SysCommonSearch: SysCommonSearch
    },

    template: template
  };
}();
